{extend name='table'}

{block name="content"}
<div class="think-box-shadow">
    {include file='dao/index_search'}
    <table id="OplogTable" data-url="{:request()->url()}" data-target-search="form.form-search"></table>
</div>
{/block}

{block name='script'}
<script>
    $(function () {
        $('#OplogTable').layTable({
            even: true, height: 'full',
            sort: {field: 'id', type: 'desc'},
            cols: [[
                {checkbox: true},
                {field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
                {field: 'vip_sn', title: '订单编号', width: 160, align: 'center'},
                {field: 'user_name', title: '用户', width: 120, align: 'center'},
                {field: 'buy_money', title: '付款金额', width: 100, align: 'center'},
                {field: 'pay_time', title: '支付时间', width: 150, align: 'center'},
                {field: 'start_time', title: '开始时间', width: 100, sort: true, align: 'center'},
                {field: 'end_time', title: '结束时间', width: 100, sort: true, align: 'center'},
                {
                    field: 'type', title: '会员类型', width: 100, align: 'center', templet: function (d) {
                        if (d.type == 'vip') {
                            return '<b class="color-green">铂金会员</b>'
                        } else if (d.type == 'svip') {
                            return '<b class="color-blue">钻石会员</b>';
                        } else if (d.type == 'mvip') {
                            return '<b class="color-red">黑钻会员</b>';
                        }
                    }
                },
                {field: 'desc', title: '支付描述', width: 250},
                {
                    field: 'pay_mode', title: '支付方式', width: 100, align: 'center', templet: function (d) {
                        if (d.pay_mode == 1) {
                            return '<b class="color-green">微信</b>';
                        } else if (d.pay_mode == 2) {
                            return '<b class="color-blue">支付宝</b>';
                        } else if (d.pay_mode == 3) {
                            return '<b class="color-red">PC后端</b>';
                        } else if (d.pay_mode == 4) {
                            return '<b class="color-desc">苹果</b>';
                        } else if (d.pay_mode == 5) {
                            return '<b class="color-text">PayPal</b>';
                        }
                    }
                },
                {
                    field: 'is_pay', title: '是否支付', width: 100, sort: true, align: 'center', templet: function (d) {
                        return d.is_pay == 1 ? '<b class="color-green">已支付</b>' : '<b class="color-red">待支付</b>';
                    }
                },
                {field: 'ip', title: 'IP', width: 120, align: 'center'},
                {field: 'create_at', title: '创建时间', width: 170, align: 'center', sort: true},
                {toolbar: '#toolbar', title: '{:lang("操作")}', align: 'center', minWidth: 80, fixed: 'right'}
            ]]
        });
    });
</script>

<script type="text/html" id="toolbar">
    <a class="layui-btn layui-btn-xs layui-bg-red" style="border: none" data-confirm="删除后无法恢复！确定要删除该记录吗？" data-action='{:url("vipDelete")}?id={{d.id}}'>删除</a>
</script>
{/block}